List comprehension - list files with extension in a directory

58

List comprehension - list files with extension in a directory -

a = [name for name in os.listdir(".") if name.endswith(".txt")]

Comments

Submit
0 Comments